package com.jiexinyun.config;

import com.jiexinyun.dto.response.AjaxResult;
import io.swagger.v3.oas.annotations.ExternalDocumentation;
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.enums.SecuritySchemeIn;
import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
import io.swagger.v3.oas.annotations.extensions.Extension;
import io.swagger.v3.oas.annotations.extensions.ExtensionProperty;
import io.swagger.v3.oas.annotations.info.Contact;
import io.swagger.v3.oas.annotations.info.Info;
import io.swagger.v3.oas.annotations.info.License;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.security.SecurityScheme;
import io.swagger.v3.oas.annotations.servers.Server;
import org.springframework.context.annotation.Configuration;
import io.swagger.v3.oas.annotations.media.Schema;



@Configuration
@OpenAPIDefinition(
        info = @Info(
                title = "捷芯云设备管理中台",
                description = "接口文档",
                version = "1.0.0",
                termsOfService = "https://www.cnblogs.com/vic-tory/",
                contact = @Contact(
                        name = "jonathan",                            // 作者名称
                        email = "jonathan@gmail.com",                  // 作者邮箱
                        url = "https://www.cnblogs.com/vic-tory/"  // 介绍作者的URL地址
                ),
                license = @License(name = "Apache 2.0",
                        url = "http://www.apache.org/licenses",
                        extensions = @Extension(name = "test", properties = @ExtensionProperty(name = "test", value = "1111")))
        ),
//        responses = {@ApiResponse(responseCode = "200", description = "成功响应", content = @Content(schema = @Schema(implementation = ApiResponse.class)))},
        /*responses = {
                @ApiResponse(
                        responseCode = "200",
                        description = "成功响应",
                        content = @Content(schema = @Schema(implementation = ApiResponse.class))
                )
        },*/
        security = @SecurityRequirement(name = "JWT认证"), //全部加上认证
        servers = {
                @Server(url = "http://localhost:8081", description = "本地测试环境-中台后端服务"),
                @Server(url = "http://123.57.16.97:8081", description = "阿里云测试环境-中台后端服")
        },
        externalDocs = @ExternalDocumentation(description = "对外说明", url = "https://www.cnblogs.com/vic-tory/")
)
@SecurityScheme(
        name = "JWT认证",                   // 认证方案名称
        type = SecuritySchemeType.HTTP,      // 认证类型，当前为http认证
        description = "使用前端传递的jwttoken进行验证",  // 描述信息
        in = SecuritySchemeIn.HEADER,        // 代表在http请求头部
        paramName = "Authorization",
        scheme = "bearer",                   // 认证方案，如：Authorization: bearer token信息
        bearerFormat = "JWT")
public class SpringDocConfig {

}
